import machine
import time
from machine import Pin
def start_led():
    pinR = machine.Pin(4, machine.Pin.OUT)
    p5 = Pin(12, Pin.IN)
    p5.value(0)
    led_state=0
    while 1:
        #time.sleep(1)
        if (p5.value() == 1):
            pinR.value(1)
            print('renti on')
            led_state = 1
        else:
            if led_state==1:
                print('renti off')
                pinR.value(0)
                led_state= 0


# pinR.value(1)
# time.sleep(1)
# pinR.value(0)